package com.ruoyi.logistic.service.impl;

import com.ruoyi.logistic.domain.NetworkSettleSubject;
import com.ruoyi.logistic.mapper.NetworkSettleSubjectMapper;
import com.ruoyi.logistic.service.NetworkSettleSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class    NetworkSettleSubjectServiceImpl implements NetworkSettleSubjectService {
    @Autowired
    private NetworkSettleSubjectMapper networkSettleSubjectMapper;

    @Override
    public List<NetworkSettleSubject> selectAll() {
        List<NetworkSettleSubject> networkSettleSubjects = networkSettleSubjectMapper.selectAll();
        for (NetworkSettleSubject networkSettleSubject : networkSettleSubjects){
            List<NetworkSettleSubject> networkSettleSubjects1 = networkSettleSubjectMapper.findTwoLevel(networkSettleSubject.getId());
            networkSettleSubject.setNetworkSettleSubjects(networkSettleSubjects1);
        }
            return networkSettleSubjects;
    }

    @Override
    public Boolean insert(NetworkSettleSubject networkSettleSubject) {
        return networkSettleSubjectMapper.insert(networkSettleSubject);
    }

    @Override
    public Boolean update(NetworkSettleSubject networkSettleSubject) {
        return networkSettleSubjectMapper.update(networkSettleSubject);
    }

    @Override
    public Boolean deleteById(Integer id) {
        return networkSettleSubjectMapper.deleteById(id);
    }

    @Override
    public NetworkSettleSubject findById(Integer id) {
        return networkSettleSubjectMapper.findById(id);
    }
}
